package com.bs.web.rest;

import com.bs.domain.ServiceInfo;
import com.bs.service.PartitionDashService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Api(value = "partitionDash")
@RestController
@RequestMapping("/api/dashboard")
public class PartitionDashResource {
    @Autowired
    PartitionDashService partitionDashService;

    @GetMapping("/callService")
    public List<ServiceInfo> callServiceResource(@RequestParam("startTime") String startTime,
                                                 @RequestParam("endTime") String endTime,
                                                 @RequestParam("partition") String partition,
                                                 @RequestParam("interval") long interval,
                                                 @RequestParam("code") String code
    ) {
        return partitionDashService.callServiceResource(partition, startTime, endTime, interval,code);
    }

    @GetMapping("/commSend")
    public List<ServiceInfo> commSendResource(@RequestParam("startTime") String startTime,
                                              @RequestParam("endTime") String endTime,
                                              @RequestParam("partition") String partition,
                                              @RequestParam("interval") long interval,
                                              @RequestParam("code") String code
    ) {
        return partitionDashService.commSendResource(partition, startTime, endTime, interval,code);
    }

    @GetMapping("/teleSend")
    public List<ServiceInfo> teleSendResource(@RequestParam("startTime") String startTime,
                                              @RequestParam("endTime") String endTime,
                                              @RequestParam("partition") String partition,
                                              @RequestParam("interval") long interval,
                                              @RequestParam("code") String code

    ) {
        return partitionDashService.teleSendResource(partition, startTime, endTime, interval,code);
    }

    @GetMapping("/callBatch")
    public List<ServiceInfo> callBatchResource(@RequestParam("startTime") String startTime,
                                               @RequestParam("endTime") String endTime,
                                               @RequestParam("partition") String partition,
                                               @RequestParam("interval") long interval,
                                               @RequestParam("code") String code
    ) {
        return partitionDashService.callBatchResource(partition, startTime, endTime, interval,code);
    }

    @GetMapping("/commReceive")
    public List<ServiceInfo> commReceiveResource(@RequestParam("startTime") String startTime,
                                                 @RequestParam("endTime") String endTime,
                                                 @RequestParam("partition") String partition,
                                                 @RequestParam("interval") long interval,
                                                 @RequestParam("code") String code
    ) {
        return partitionDashService.commReceiveResource(partition, startTime, endTime, interval,code);
    }


    @GetMapping("/teleReceive")
    public List<ServiceInfo> teleReceiveResource(@RequestParam("startTime") String startTime,
                                                 @RequestParam("endTime") String endTime,
                                                 @RequestParam("partition") String partition,
                                                 @RequestParam("interval") long interval,
                                                 @RequestParam("code") String code
    ) {
        return partitionDashService.teleReceiveResource(partition, startTime, endTime, interval,code);
    }

}
